/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nxtmodel2.impl;

import nxtmodel2.ModifiedMotor;
import nxtmodel2.Motor;
import nxtmodel2.Nxtmodel2Package;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Modified Motor</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nxtmodel2.impl.ModifiedMotorImpl#getEstado <em>Estado</em>}</li>
 *   <li>{@link nxtmodel2.impl.ModifiedMotorImpl#getModifiedMotor <em>Modified Motor</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ModifiedMotorImpl extends NxtElementImpl implements ModifiedMotor {
	/**
	 * The default value of the '{@link #getEstado() <em>Estado</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEstado()
	 * @generated
	 * @ordered
	 */
	protected static final String ESTADO_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getEstado() <em>Estado</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEstado()
	 * @generated
	 * @ordered
	 */
	protected String estado = ESTADO_EDEFAULT;

	/**
	 * The cached value of the '{@link #getModifiedMotor() <em>Modified Motor</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getModifiedMotor()
	 * @generated
	 * @ordered
	 */
	protected Motor modifiedMotor;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ModifiedMotorImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Nxtmodel2Package.Literals.MODIFIED_MOTOR;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getEstado() {
		return estado;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEstado(String newEstado) {
		String oldEstado = estado;
		estado = newEstado;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Nxtmodel2Package.MODIFIED_MOTOR__ESTADO, oldEstado, estado));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor getModifiedMotor() {
		if (modifiedMotor != null && modifiedMotor.eIsProxy()) {
			InternalEObject oldModifiedMotor = (InternalEObject)modifiedMotor;
			modifiedMotor = (Motor)eResolveProxy(oldModifiedMotor);
			if (modifiedMotor != oldModifiedMotor) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR, oldModifiedMotor, modifiedMotor));
			}
		}
		return modifiedMotor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Motor basicGetModifiedMotor() {
		return modifiedMotor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setModifiedMotor(Motor newModifiedMotor) {
		Motor oldModifiedMotor = modifiedMotor;
		modifiedMotor = newModifiedMotor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR, oldModifiedMotor, modifiedMotor));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Nxtmodel2Package.MODIFIED_MOTOR__ESTADO:
				return getEstado();
			case Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR:
				if (resolve) return getModifiedMotor();
				return basicGetModifiedMotor();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Nxtmodel2Package.MODIFIED_MOTOR__ESTADO:
				setEstado((String)newValue);
				return;
			case Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR:
				setModifiedMotor((Motor)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.MODIFIED_MOTOR__ESTADO:
				setEstado(ESTADO_EDEFAULT);
				return;
			case Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR:
				setModifiedMotor((Motor)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.MODIFIED_MOTOR__ESTADO:
				return ESTADO_EDEFAULT == null ? estado != null : !ESTADO_EDEFAULT.equals(estado);
			case Nxtmodel2Package.MODIFIED_MOTOR__MODIFIED_MOTOR:
				return modifiedMotor != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (estado: ");
		result.append(estado);
		result.append(')');
		return result.toString();
	}

} //ModifiedMotorImpl
